<!Doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>新书上架...</title>
    <link rel="stylesheet" type="text/css" href="../css/common.css"/>
    <link rel="stylesheet" type="text/css" href="../css/main.css"/>
    <script type="text/javascript" src="../js/modernizr.min.js"></script>
    <script type="text/javascript" src="../js/jquery-1.11.0.min.js"></script>
    <script type="text/javascript" src="../js/getParameter.js"></script>
    <script>
        $(function () {
            $("#header").load("../static/header.html");
            $("#left").load("../static/left.html");
            $.get("../user/getLoginInfo.do", {}, function (data) {
                if (data == null) {
                    alert("请先登录。。");
                    location.href = "../user/login.do";
                }
            });
            //填充属性
            var addressId = getParameter("addressId");
            $("#addressId").val(addressId);
            //回显数据
            $.post("../address/getAddressOne.do",{addressId:addressId},function (data) {
                    $("#name").val(data.name);
                    $("#phone").val(data.phone);
                    $("#address").val(data.address);
            });
            //修改操作
            $('#myform_up').submit(function () {
                $.post("../address/upAddress.do", $(this).serialize(), function (data) {
                    alert(data.errorInfo);
                    if (data.errorType == 0) {
                        location.reload();
                    }
                });
                //取消表单提交
                return false;
            });
        });
    </script>
</head>
<body>

<div class="container clearfix">
    <div id="header"></div>
    <div id="left"></div>
    <!--/sidebar-->
    <div class="main-wrap">
        <div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i><a href="address.html">地址管理</a><span
                    class="crumb-step">&gt;</span><span class="crumb-name">修改新地址</span></div>
        </div>
        <div class="result-wrap">
            <form action="../address/upAddress.do" method="post" id="myform_up">
                <input id="addressId" name="addressId" hidden value="">
                <div class="config-items">
                    <div class="config-title">
                        <h1><i class="icon-font">&#xe00a;</i>修改新地址</h1>
                    </div>
                    <div class="result-content">
                        <table width="100%" class="insert-tab">
                            <tbody>
                            <tr>
                                <th width="15%"><i class="require-red">*</i>收货人：</th>
                                <td><input type="text" placeholder="收货人姓名.." name="name" id="name"
                                           class="common-text"></td>
                            </tr>
                            <tr>
                                <th width="15%"><i class="require-red">*</i>手机号：</th>
                                <td><input type="text" placeholder="请输入手机号.." name="phone" id="phone"
                                           class="common-text"></td>
                            </tr>
                            <tr>
                                <th width="15%"><i class="require-red">*</i>收货地址：</th>
                                <td><input type="text" placeholder="请输入收货地址.." name="address" id="address"
                                           class="common-text"></td>
                            </tr>

                            <tr>
                                <th></th>
                                <td>
                                    <!--<input type="submit" value="提交" class="btn btn-primary btn6 mr10">-->
                                    <input type="submit" value="提交" class="btn btn-primary btn6 mr10" id="submit">
                                    <input type="button" value="返回" onclick="history.go(-1)" class="btn btn6">
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
</html>